﻿<%@ Page Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage" %>

<asp:Content ID="loginTitle" ContentPlaceHolderID="head" runat="server">
</asp:Content>

<asp:Content ID="loginContent" ContentPlaceHolderID="MainContent" runat="server">

<script type="text/javascript" language="javascript">
   
    $(document).ready(function() {
        $("#LogOnForm").validate({
            rules: {
                username: {
                    required: true
                },
                password: {
                    required: true
                }

            },
            messages: {
                username: {
                    required: "UserName cannot be blank"
                },
                password: {
                    required: "Password cannot be blank"
                }
            }
        });
    });
    </script>

    <h2>Log On</h2>
    
    <%= Html.ValidationSummary("Login was unsuccessful. Please correct the errors and try again.") %>

    <% using (Html.BeginForm("LogOn", "Account", FormMethod.Post, new { id = "LogOnForm" }))
         {%>
        <div>
            <fieldset>
                <legend>Account Information</legend>
                <p>
                    <label for="username">Username:</label>
                    <%= Html.TextBox("username") %>
                    <%= Html.ValidationMessage("username") %>
                </p>
                <p>
                    <label for="password">Password:</label>
                    <%= Html.Password("password") %>
                    <%= Html.ValidationMessage("password") %>
                </p>
                <p>
                    <%= Html.CheckBox("rememberMe") %> <label class="inline" for="rememberMe">Remember me?</label>
                </p>
                <p>
                    <input type="submit" id="btnSubmit" value="Log On" /> 
                    <input id="Register" type="button" style="visibility:hidden" onclick="javascript:window.location.replace('<%= Url.Action("Register", "Account") %>');" value="Register" />
                </p>
            </fieldset>
        </div>
    <% } %>
</asp:Content>
